<template>
  <div class="login-container">
    <div class="login-box">
      <div class="login-header">OpsPlatform管理系统</div>
      <div class="login-form">
          <login-form @on-success-valid="handleSubmit"></login-form>
          <!-- <p class="login-tip">输入任意用户名和密码即可</p> -->
        </div>
    </div>
  </div>
</template>

<script>
import LoginForm from '_c/login-form'
import { mapActions } from 'vuex'
export default {
  components: {
    LoginForm
  },
  methods: {
    ...mapActions([
      'handleLogin',
      'getUserInfo'
    ]),
    handleSubmit ({ username, password, switchStatus }) {
      this.handleLogin({ username, password, switchStatus }).then(res => {
        this.getUserInfo().then(res => {
          this.$router.push({
            name: this.$config.homeName
          })
        })
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss">
.login-container {
    height: 100%;
    width: 100%;
    font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
      Microsoft YaHei, SimSun, sans-serif;
    -webkit-font-smoothing: antialiased;
    background-color: #F0F0F0;
  }
  .login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1px;
    .login-box {
      position: relative;
      width: 1050px;
      height: 650px;
      box-shadow: 0 0 187px 0 rgba(49, 49, 50, 0.36);
      border-radius: 5px;
      background: url('../../assets/images/login.png') no-repeat -99px -120px;

      .login-header {
        position: absolute;
        right: 90px;
        top: 120px;
        color: #515F6E;
        font-size: 22px
      }
      .login-form {
        position: absolute;
        right: 40px;
        top: 240px;
        width: 300px;
      }
    }
  }
</style>